home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Workfile:: BSNG API.h $
- * $Revision:: 2 $
- *
- * $Author:: Buck Rogers $
- * $Modtime:: 05.10.1997 19:10 Uhr $
- *
- * $History:: BSNG API.h $
- *
- * ***************** Version 2 *****************
- * User: Buck Rogers Date: 05.10.1997 Time: 19:12 Uhr
- * Updated in $/BSNG/Plugins/BSNG SDK
- * Added name, company and number of copies items that contain the default
- * values set in the BSNG App preferences
- *
- * ***************** Version 1 *****************
- * User: Buck Rogers Date: 30.09.1997 Time: 18:31 Uhr
- * Created in $/BSNG/Plugins/BSNG SDK
- * Adding subproject 'BSNG' to '$/'
- *
- * $NoKeywords:: $
- */
-
-
- #pragma once
-
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- /*
- These are the IDs of the 10 LGAEditField you can use.
- MAKE SURE THAT EVERY LGAEditField YOU ADD TO YOUR LAYOUT IS WITHIN THAT RANGE!!!
-
- Note: The only items that need special ID and/or message ranges are:
- LGAEditFields (ID range: between kEditItem1 = 100001 to kEditItem10 = 100010)
- LGAPushButtons (ID and message range: between 300000 and 399999)
-
- Everything else you add, like LGACaptions or LGAFocusBorders should have an ID smaller than 100000 though to
- avoid possible conflicts with the BSNG App in the future.
- */
-
- enum EditFieldItem {kEditItem1 = 100001, kEditItem2 = 100002, kEditItem3 = 100003, kEditItem4 = 100004, kEditItem5 = 100005,
- kEditItem6 = 100006, kEditItem7 = 100007, kEditItem8 = 100008, kEditItem9 = 100009, kEditItem10 = 100010};
-
- /*
- These are values you can use to access the itemValue array. If you want to access the value the user entered in your
- LGAEditField with the ID kEditItem2 you can use itemValue[1] or for more readability itemValue[kItemValue2]
- */
-
- enum EditFieldValue {kItemValue1 = 0, kItemValue2 = 1, kItemValue3 = 2, kItemValue4 = 3, kItemValue5 = 4,
- kItemValue6 = 5, kItemValue7 = 6, kItemValue8 = 7, kItemValue9 = 8, kItemValue10 = 9};
-
- /*
- Here are the descriptions of all the possible messages your plugin can recieve:
-
- msgExtInit Will be passed when your plugin gets loaded.
- This is the time to set the 'wantsRandomButton' and 'canAddToSNList' values and to initialize your
- global variables. You should also load all additional resources (if you use any in your plug) that
- are needed for your calculations, like CRC tables etc., at this point of time.
- If your initialisation failed for some reason report that back to the BSNG App by setting 'error'
- to errExtInitFailed, if your init was successful set 'error' to errExtNoErr
-
- msgExtCalcHit Will be passed when the user pressed the 'Calculate' button in the BSNG App.
- You should validate all necessary data for your calculations (passed to you in the 'itemValue' array)
- before you start calculating. set 'error' to errExtIncorrectValue with the corresponding
- EditFieldItem in 'errorInItem' back to the BSNG App if the validation failed.
- If the validation was succesful start your calculation and pass the result back in the appropiate entry
- in the 'itemValue' array (e.g. use itemValue[kItemValue2] if your output LGAEditField has the ID kEditItem2,
- use itemValue[kItemValue3] if your output LGAEditField has the ID kEditItem3 etc).
-
- msgExtRandomHit You will only receive that message if you set 'wantsRandomButton' to true at Init time.
- Create a random serial number not dependent on user input and fill in all the necessary data into the
- 'itemValue' array to display your calculations (see msgExtCalcHit how to do that)
-
- msgExtItemHit You will receive that message only when you added one or more LGAPushButtons to your layout.
- The LGAPushButton IDs and messages have to be between 300000 and 399999 to make this work. The message
- of the LGAPushButton that was pressed will be passed to you in 'itemMessage'.
- You can do lots of things with this feature, like display your own about box, play a sound or whatever
- else comes to your mind. Actually this is very powerful because you get all control you need to
- 'customize' your plugin, but please keep in mind not to 'bloat' your plugin by adding too much fancy stuff.
- All the values you probably changed for some reason in the 'itemValue' array will be displayed to the user
- when the BSNG App gets control again. Have fun :-)
-
-
- msgExtCreateRandom Your plugin will only get this message if you set 'canAddToSNList' to true at Init time.
- Use the 'outputRefNum' to write your randomly calculated serial numbers to the filestream.
- Use FSWrite and/or the helper functions myOutputPStr, myOutputSuffixedPStr, myOutputText
- and myOutputSuffixedText from "standard utils" (included with this package) to write to the filestream.
- You should calculate 'numOfListNumbers' random numbers if you can and write them to the stream...
-
- msgExtCleanup Will be passed when your plugin gets unloaded.
- All memory allocations you made at Init time or whenever and all the resources you loaded should be
- deallocated/freed/dissposed when your plugin receives this message to avoid memory leaks.
- */
-
-
- enum ExternalMessage {msgExtInit = 1, msgExtCalcHit = 2, msgExtRandomHit = 3, msgExtItemHit = 4, msgExtCreateRandom = 5, msgExtCleanup = 6};
-
- /*
- Here are the descriptions of all supported errors at the moment. If you pass another value back to the BSNG App than those
- listed here the user will be prompted with an 'the plugin reported an unknown error, please continue with caution' alert
-
- errExtInitFailed Your plugin failed to initialize itself at Init time
-
- errExtIncorrectValue report that error at msgExtCalcHit if the user entered an incorrect value into one of the LGAEditField.
- Report the field containing the error back to the BSNG App by setting 'errorInItem' to the
- corresponding LGAEditField ID (kEditItem1...kEditItem10)
-
- errExtWritingToList report that error when you got the msgExtCreateRandom message and for one or the other reason can't
- write your data to the list. If you report that error the creation of the complete list will be aborted.
-
- errExtNoErr report this if everything works fine :-)
- */
-
- enum ExternalError {errExtInitFailed = -100000, errExtIncorrectValue = -100001, errExtWritingToList = -100002, errExtNoErr = 0};
-
-
- typedef struct
- {
- short theMessage; /* set by the BSNG App, you have to react to these messages */
- /* (see ExternalMessage above) */
-
- unsigned long itemMessage; /* if you added one or more LGAPushButtons (please only use LGAPushButtons, */
- /* no other controls are supported yet) to your layout you find the message you */
- /* configured for that LGAPushButton in here. LGAPushButton IDs and messages MUST be */
- /* between 300000 and 399999 */
-
- Boolean wantsRandomButton; /* set to true at Init time if your plugin can create random serial numbers */
-
- Boolean canAddToSNList; /* set to true at Init time if your plugin can create numbers for the */
- /* Random Serial Number List */
-
- Str63 name; /* name, company and numCopies are default values entered in the BSNG App preferences. */
- Str63 company; /* if possible copy these in values in the corresponding itemValue items at Init time */
- Str15 numCopies; /* so that these values can appear as default in your generator. Also make sure that */
- /* you make a serial number using these infos when the Serial Number List gets */
- /* created (of course only if your plugin is a name-based algorithm) */
-
- unsigned short numOfListNumbers; /* how many numbers to create for the random Serial Number List */
-
- short outputRefNum; /* the reference number of the file to write to when we build the */
- /* random Serial Number List */
-
- long error; /* if an error occured put the appropiate error number (see 'ExternalError' above) */
- /* in here */
-
- unsigned long errorInItem; /* if the error that occured is of type 'errExtIncorrectValue' put the
- /* appropiate 'EditFieldItem' in here. Lets say the wrong value is in itemValue[3] */
- /* which is equal to itemValue[kItemValue4] put kEditItem4 into this field */
-
- unsigned long randSeed1; /* set by the BSNG App, you can use these two randSeed values to initialize the */
- unsigned long randSeed2; /* Ultra Random Number Generator (source included) or any other Random Number Gen */
-
- unsigned long appLaunchTime; /* set by the BSNG App, the time the BSNG App was launched in Ticks */
- DateTimeRec appLaunchDate; /* set by the BSNG App, the time the BSNG App was launched in a DateTimeRec */
-
- StringPtr itemValue[10]; /* You can add up to 10 LGAEditFields to your layout (please only use LGAEditFields, */
- /* no other TextEdit fields are supported yet). The IDs of your LGAEditField MUST be
- /* between 100001 and 100010 (kEditItem1...kEditItem10) */
- } BSNGParamBlock, *BSNGParamBlockPtr;
-
-
- /*
- IMPORTANT!!! additional notes:
-
- You MUST create the following resouces, otherwise your plugin will not work:
-
- 'cicn' ID 1000 must contain the icon displayed in the plugin list in the BSNG App
- 'STR ' ID 1000 must contain the text displayed under the icon, the max. supported length of this text is 27 characters
- 'PPob' ID 1000 must contain the layout displayed on the right side of the serial number generator window when your plugin
- gets selected. Use Metrowerks Constructor 2.4.2 or better (included in this distribution) to cusomize this view,
- but keep in mind what I told you about the LGAPushButtons and LGAEditFields earlier in this document.
- */
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-